package ceha.application.consultation;

import ceha.application.CEHA;
import java.awt.Desktop;
import java.beans.Beans;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableColumn;

public class ConsultationFrame extends javax.swing.JFrame {

//    private boolean flagclicOne;
    private CEHA main;

    public ConsultationFrame(CEHA main) {

        initComponents();
        if (!Beans.isDesignTime()) {
            entityManager.getTransaction().begin();
        }
        this.main = main;

//        System.out.println(screenSize.width+","+screenSize.height);
//        int inset = 100;
//        if (main.is17pouces()) {
//
//            setBounds(inset, inset, 1280 - inset * 2, 1024 - inset * 2);
//        } else {
//            inset = 50;
//            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
//            setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2);
//        }


    }

    public JPanel getRecherches() {
        return recherches;
    }

    public JButton getFiltrerB() {
        return filtrerB;
    }

    public JTextField getFiltrerF() {
        return filtrerF;
    }

    public JTable getMasterTable() {
        return masterTable;
    }

    public JPanel getTablePanel() {
        return tablePanel;
    }

    private void detruireColonne(TableColumn column) {
        column.setMinWidth(0);
        column.setMaxWidth(0);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("BDDCEHAPU").createEntityManager();
        query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT f FROM Fiche f");
        list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList());
        recherches = new javax.swing.JPanel();
        suivant = new javax.swing.JButton();
        mot1 = new javax.swing.JTextField();
        mot2 = new javax.swing.JTextField();
        mot3 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        effacer = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        tablePanel = new javax.swing.JPanel();
        masterscrollpane = new javax.swing.JScrollPane();
        masterTable = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        filtrerB = new javax.swing.JButton();
        filtrerF = new javax.swing.JTextField();
        descritionpanel = new javax.swing.JPanel();
        historicpanel = new javax.swing.JPanel();
        dimensionLabel = new javax.swing.JLabel();
        localisationLabel = new javax.swing.JLabel();
        droitsreproLabel = new javax.swing.JLabel();
        datedonationLabel = new javax.swing.JLabel();
        fondLabel = new javax.swing.JLabel();
        fondField = new javax.swing.JTextField();
        localisationField = new javax.swing.JTextField();
        dimensionField = new javax.swing.JTextField();
        jDateChooser2 = new com.toedter.calendar.JDateChooser();
        droitreproF = new javax.swing.JTextField();
        CadreVignette = new javax.swing.JPanel();
        vignette = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        resumeLabel = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        typedocumentLabel1 = new javax.swing.JLabel();
        dateLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        resumeArea = new javax.swing.JTextArea();
        lienfichierLabel = new javax.swing.JLabel();
        auteurLabel = new javax.swing.JLabel();
        lienvignette = new javax.swing.JTextField();
        titreLabel = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        datetexteLabel1 = new javax.swing.JLabel();
        jDateChooser1 = new com.toedter.calendar.JDateChooser();
        origOuCopieF = new javax.swing.JTextField();
        typdocF = new javax.swing.JTextField();
        auteurField = new javax.swing.JTextField();
        lienimageField = new javax.swing.JTextField();
        lienimageLabel = new javax.swing.JLabel();
        sourceLabel = new javax.swing.JLabel();
        imagefilenameLabel = new javax.swing.JLabel();
        lienfichierB = new javax.swing.JButton();

        recherches.setBackground(new java.awt.Color(102, 102, 102));

        suivant.setFont(new java.awt.Font("Verdana", 1, 14));
        suivant.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/entrez.gif"))); // NOI18N
        suivant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                suivantA(evt);
            }
        });

        mot1.setFont(new java.awt.Font("Tahoma", 0, 14));

        mot2.setFont(new java.awt.Font("Tahoma", 0, 14));

        mot3.setFont(new java.awt.Font("Tahoma", 0, 14));

        jLabel1.setBackground(new java.awt.Color(204, 204, 204));
        jLabel1.setFont(new java.awt.Font("Trebuchet MS", 1, 14));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Recherche");
        jLabel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jLabel1.setOpaque(true);

        effacer.setFont(new java.awt.Font("Times New Roman", 1, 12));
        effacer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/gomme.gif"))); // NOI18N
        effacer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                effacerA(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Trebuchet MS", 1, 14));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Titre");

        jLabel3.setFont(new java.awt.Font("Trebuchet MS", 1, 14));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Auteur");

        jLabel4.setFont(new java.awt.Font("Trebuchet MS", 1, 14));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Résumé");

        jLabel5.setFont(new java.awt.Font("Trebuchet MS", 3, 14));
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("Suivant");

        jLabel6.setFont(new java.awt.Font("Trebuchet MS", 3, 14));
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("effacer");

        javax.swing.GroupLayout recherchesLayout = new javax.swing.GroupLayout(recherches);
        recherches.setLayout(recherchesLayout);
        recherchesLayout.setHorizontalGroup(
            recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(recherchesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addGroup(recherchesLayout.createSequentialGroup()
                        .addGroup(recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(suivant, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 68, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(effacer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(mot1, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(mot2, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(mot3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)))
                .addContainerGap())
        );
        recherchesLayout.setVerticalGroup(
            recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, recherchesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2)
                .addGap(5, 5, 5)
                .addComponent(mot1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(7, 7, 7)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(mot2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(13, 13, 13)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(mot3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 341, Short.MAX_VALUE)
                .addGroup(recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(recherchesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(suivant, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(effacer, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        masterTable.setGridColor(new java.awt.Color(0, 0, 0));

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${id}"));
        columnBinding.setColumnName("Id");
        columnBinding.setColumnClass(Integer.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${imagefilename}"));
        columnBinding.setColumnName("Imagefilename");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${source}"));
        columnBinding.setColumnName("Source");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${typedocument}"));
        columnBinding.setColumnName("Typedocument");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${titre}"));
        columnBinding.setColumnName("Titre");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${auteur}"));
        columnBinding.setColumnName("Auteur");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${date}"));
        columnBinding.setColumnName("Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${datetexte}"));
        columnBinding.setColumnName("Datetexte");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${resume}"));
        columnBinding.setColumnName("Resume");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${lienfichier}"));
        columnBinding.setColumnName("Lienfichier");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${lienimage}"));
        columnBinding.setColumnName("Lienimage");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fond}"));
        columnBinding.setColumnName("Fond");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${datedonation}"));
        columnBinding.setColumnName("Datedonation");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${droitsrepro}"));
        columnBinding.setColumnName("Droitsrepro");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${localisation}"));
        columnBinding.setColumnName("Localisation");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${dimension}"));
        columnBinding.setColumnName("Dimension");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${datecorrection}"));
        columnBinding.setColumnName("Datecorrection");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${idcorrecteur}"));
        columnBinding.setColumnName("Idcorrecteur");
        columnBinding.setColumnClass(Integer.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        masterTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                masterTableMouseClicked(evt);
            }
        });
        masterscrollpane.setViewportView(masterTable);

        filtrerB.setText("Filtrer");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(filtrerB, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(filtrerF, javax.swing.GroupLayout.PREFERRED_SIZE, 370, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(557, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(filtrerB)
                    .addComponent(filtrerF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        javax.swing.GroupLayout tablePanelLayout = new javax.swing.GroupLayout(tablePanel);
        tablePanel.setLayout(tablePanelLayout);
        tablePanelLayout.setHorizontalGroup(
            tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tablePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(masterscrollpane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 1016, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        tablePanelLayout.setVerticalGroup(
            tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tablePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(masterscrollpane, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("CEHA - CONSULTATION DES FICHES");
        setResizable(false);

        descritionpanel.setBackground(new java.awt.Color(204, 204, 204));

        historicpanel.setBackground(new java.awt.Color(153, 153, 153));
        historicpanel.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 204, 0), 2, true), "historique du document", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 3, 14), new java.awt.Color(255, 204, 0))); // NOI18N

        dimensionLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        dimensionLabel.setText("Dimensions");

        localisationLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        localisationLabel.setText("Localisation");

        droitsreproLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        droitsreproLabel.setText("Droits de reproduction");

        datedonationLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        datedonationLabel.setText("Date de donation");

        fondLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        fondLabel.setText("Fonds/provenance");

        fondField.setEditable(false);
        fondField.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.fond}"), fondField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        localisationField.setEditable(false);
        localisationField.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.localisation}"), localisationField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        dimensionField.setEditable(false);
        dimensionField.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.dimension}"), dimensionField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jDateChooser2.setDateFormatString("DD MM YYYY");
        jDateChooser2.setEnabled(false);
        jDateChooser2.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.datedonation}"), jDateChooser2, org.jdesktop.beansbinding.BeanProperty.create("date"));
        bindingGroup.addBinding(binding);

        droitreproF.setEditable(false);
        droitreproF.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.droitsrepro}"), droitreproF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        javax.swing.GroupLayout historicpanelLayout = new javax.swing.GroupLayout(historicpanel);
        historicpanel.setLayout(historicpanelLayout);
        historicpanelLayout.setHorizontalGroup(
            historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(historicpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(historicpanelLayout.createSequentialGroup()
                        .addComponent(localisationLabel)
                        .addContainerGap(413, Short.MAX_VALUE))
                    .addGroup(historicpanelLayout.createSequentialGroup()
                        .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(droitsreproLabel)
                            .addComponent(dimensionLabel)
                            .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(fondLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(datedonationLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(dimensionField, javax.swing.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE)
                            .addComponent(droitreproF, javax.swing.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE)
                            .addGroup(historicpanelLayout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(fondField, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE))
                            .addComponent(localisationField, javax.swing.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE)
                            .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)))))
        );
        historicpanelLayout.setVerticalGroup(
            historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(historicpanelLayout.createSequentialGroup()
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fondLabel)
                    .addComponent(fondField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(datedonationLabel)
                    .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(droitsreproLabel)
                    .addComponent(droitreproF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(localisationLabel)
                    .addComponent(localisationField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(dimensionLabel)
                    .addComponent(dimensionField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        CadreVignette.setBackground(new java.awt.Color(204, 204, 204));
        CadreVignette.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));

        vignette.setBackground(new java.awt.Color(255, 255, 255));
        vignette.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        vignette.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/fondlogoCEHA.jpg"))); // NOI18N
        vignette.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BELOW_TOP, new java.awt.Font("Verdana", 3, 12), new java.awt.Color(0, 0, 0))); // NOI18N

        javax.swing.GroupLayout CadreVignetteLayout = new javax.swing.GroupLayout(CadreVignette);
        CadreVignette.setLayout(CadreVignetteLayout);
        CadreVignetteLayout.setHorizontalGroup(
            CadreVignetteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CadreVignetteLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(vignette, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        CadreVignetteLayout.setVerticalGroup(
            CadreVignetteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CadreVignetteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(vignette, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        resumeLabel.setBackground(new java.awt.Color(153, 153, 153));
        resumeLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        resumeLabel.setForeground(new java.awt.Color(51, 51, 51));
        resumeLabel.setText("Résumé");

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.titre}"), jTextArea1, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jScrollPane2.setViewportView(jTextArea1);

        typedocumentLabel1.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        typedocumentLabel1.setText("Type de document");

        dateLabel.setBackground(new java.awt.Color(153, 153, 153));
        dateLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        dateLabel.setForeground(new java.awt.Color(51, 51, 51));
        dateLabel.setText("Date ");

        resumeArea.setColumns(20);
        resumeArea.setEditable(false);
        resumeArea.setFont(new java.awt.Font("Trebuchet MS", 1, 14));
        resumeArea.setLineWrap(true);
        resumeArea.setRows(5);
        resumeArea.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        resumeArea.setDragEnabled(true);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.resume}"), resumeArea, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jScrollPane1.setViewportView(resumeArea);

        lienfichierLabel.setBackground(new java.awt.Color(153, 153, 153));
        lienfichierLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        lienfichierLabel.setText("Lien vers un fichier (PDF)");

        auteurLabel.setBackground(new java.awt.Color(153, 153, 153));
        auteurLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        auteurLabel.setForeground(new java.awt.Color(51, 51, 51));
        auteurLabel.setText("Auteur");

        lienvignette.setEditable(false);
        lienvignette.setFont(new java.awt.Font("Trebuchet MS", 1, 12));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.imagefilename}"), lienvignette, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        titreLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        titreLabel.setForeground(new java.awt.Color(51, 51, 51));
        titreLabel.setText("Titre*");

        jTextField1.setEditable(false);
        jTextField1.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.datetexte}"), jTextField1, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        datetexteLabel1.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        datetexteLabel1.setText("Date(autres)");

        jDateChooser1.setDateFormatString("DD MM YYYY");
        jDateChooser1.setEnabled(false);
        jDateChooser1.setFont(new java.awt.Font("Trebuchet MS", 1, 12));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.date}"), jDateChooser1, org.jdesktop.beansbinding.BeanProperty.create("date"));
        bindingGroup.addBinding(binding);

        origOuCopieF.setEditable(false);
        origOuCopieF.setFont(new java.awt.Font("Trebuchet MS", 1, 12));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.source}"), origOuCopieF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        typdocF.setEditable(false);
        typdocF.setFont(new java.awt.Font("Trebuchet MS", 1, 12));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.typedocument}"), typdocF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        auteurField.setEditable(false);
        auteurField.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.auteur}"), auteurField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        lienimageField.setEditable(false);
        lienimageField.setFont(new java.awt.Font("Trebuchet MS", 1, 14));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.lienimage}"), lienimageField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        lienimageLabel.setBackground(new java.awt.Color(153, 153, 153));
        lienimageLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        lienimageLabel.setForeground(new java.awt.Color(51, 51, 51));
        lienimageLabel.setText("Lien vers une image");

        sourceLabel.setBackground(new java.awt.Color(153, 153, 153));
        sourceLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        sourceLabel.setForeground(new java.awt.Color(51, 51, 51));
        sourceLabel.setText("Source");

        imagefilenameLabel.setBackground(new java.awt.Color(153, 153, 153));
        imagefilenameLabel.setFont(new java.awt.Font("Trebuchet MS", 1, 12));
        imagefilenameLabel.setForeground(new java.awt.Color(51, 51, 51));
        imagefilenameLabel.setText("Vignette");

        lienfichierB.setFont(new java.awt.Font("Trebuchet MS", 3, 14));
        lienfichierB.setText("- - -");

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.lienfichier}"), lienfichierB, org.jdesktop.beansbinding.BeanProperty.create("label"));
        bindingGroup.addBinding(binding);

        lienfichierB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fichierpdfB(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lienfichierB, javax.swing.GroupLayout.PREFERRED_SIZE, 361, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(33, 33, 33)
                                .addComponent(lienimageLabel))
                            .addComponent(resumeLabel)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(30, 30, 30)
                                .addComponent(lienfichierLabel))
                            .addComponent(titreLabel)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(lienimageField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(auteurLabel)
                                            .addComponent(dateLabel))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(datetexteLabel1)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))
                                            .addComponent(auteurField, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(imagefilenameLabel)
                                            .addComponent(sourceLabel))
                                        .addGap(6, 6, 6)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(typedocumentLabel1, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(origOuCopieF, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)
                                            .addComponent(lienvignette, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)))
                                    .addComponent(typdocF, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)))
                                .addGap(127, 127, 127)))
                        .addGap(0, 0, 0))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lienvignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(imagefilenameLabel))
                .addGap(10, 10, 10)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(origOuCopieF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(sourceLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(typedocumentLabel1)
                .addGap(7, 7, 7)
                .addComponent(typdocF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(titreLabel)
                .addGap(7, 7, 7)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(9, 9, 9)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(auteurLabel)
                    .addComponent(auteurField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(dateLabel)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(datetexteLabel1)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(resumeLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lienfichierLabel)
                .addGap(2, 2, 2)
                .addComponent(lienfichierB, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lienimageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lienimageField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout descritionpanelLayout = new javax.swing.GroupLayout(descritionpanel);
        descritionpanel.setLayout(descritionpanelLayout);
        descritionpanelLayout.setHorizontalGroup(
            descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(descritionpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(historicpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(descritionpanelLayout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 407, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(CadreVignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        descritionpanelLayout.setVerticalGroup(
            descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(descritionpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CadreVignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(historicpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(descritionpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(descritionpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        bindingGroup.bind();

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-662)/2, (screenSize.height-715)/2, 662, 715);
    }// </editor-fold>//GEN-END:initComponents
//            String reqauteur = "SELECT * FROM fiche WHERE auteur = '" + mot2.getText() + "'";
//            String reqresume = "SELECT * FROM fiche WHERE resume = '" + mot3.getText() + "'";

//            ResultSet Result2 = stmt.executeQuery(reqauteur);
//            ResultSet Result3 = stmt.executeQuery(reqresume);
    //        while (Result1.next()) {
//            int id = Result1.getInt("id");
//            String filename = (String) masterTable.getValueAt(id, 1);
//
//            System.out.println(id);
//        }
//    catch (SQLException ex) {
//            ex.printStackTrace();
//        }
    private void suivantA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_suivantA
        try {
            Connection connection = main.getConn();
            Statement statement = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            String sqlTitre = "SELECT * FROM fiche WHERE titre = '" + mot1.getText() + "'";
            ResultSet resultat = statement.executeQuery(sqlTitre);

            while (resultat.next()) {
                int id = resultat.getInt(1);
                String nom = resultat.getString(2);
                double prix = resultat.getDouble(3);
                java.sql.Date date = resultat.getDate(4);
                int row = resultat.getRow();
                System.out.println("Données contenues dans la ligne " + row);
                System.out.println("id : " + id + " nom : " + nom + " prix : " + prix + " date : " + date);
            }
        } catch (SQLException ex) {
            Logger.getLogger(ConsultationFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

}//GEN-LAST:event_suivantA

    private void effacerA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_effacerA
        mot1.setText("");
        mot2.setText("");
        mot3.setText("");
}//GEN-LAST:event_effacerA

    private void masterTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_masterTableMouseClicked
        int id = masterTable.getSelectedRow();
        String filename = (String) masterTable.getValueAt(id, 1);
        System.out.println(id);

//        String lienfichier = (String) masterTable.getValueAt(id, 8);
//        lienFichierButton.setText(lienfichier);


        if (filename == null) {
            vignette.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/fondlogoCEHA.jpg")));


        } else {
            vignette.setIcon(new javax.swing.ImageIcon(filename));


        }

    }//GEN-LAST:event_masterTableMouseClicked

    private void fichierpdfB(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fichierpdfB
        String reader = main.getAdminparam().getPdfreaderF();
        Runtime runtime = Runtime.getRuntime();
        try {// 2 parametres pris dans un tableau, l'appli et le pdf
            runtime.exec(new String[]{reader, lienfichierB.getText()});
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_fichierpdfB
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel CadreVignette;
    private javax.swing.JTextField auteurField;
    private javax.swing.JLabel auteurLabel;
    private javax.swing.JLabel dateLabel;
    private javax.swing.JLabel datedonationLabel;
    private javax.swing.JLabel datetexteLabel1;
    private javax.swing.JPanel descritionpanel;
    private javax.swing.JTextField dimensionField;
    private javax.swing.JLabel dimensionLabel;
    private javax.swing.JTextField droitreproF;
    private javax.swing.JLabel droitsreproLabel;
    private javax.swing.JButton effacer;
    private javax.persistence.EntityManager entityManager;
    private javax.swing.JButton filtrerB;
    private javax.swing.JTextField filtrerF;
    private javax.swing.JTextField fondField;
    private javax.swing.JLabel fondLabel;
    private javax.swing.JPanel historicpanel;
    private javax.swing.JLabel imagefilenameLabel;
    private com.toedter.calendar.JDateChooser jDateChooser1;
    private com.toedter.calendar.JDateChooser jDateChooser2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JButton lienfichierB;
    private javax.swing.JLabel lienfichierLabel;
    private javax.swing.JTextField lienimageField;
    private javax.swing.JLabel lienimageLabel;
    private javax.swing.JTextField lienvignette;
    private java.util.List<ceha.Fiche> list;
    private javax.swing.JTextField localisationField;
    private javax.swing.JLabel localisationLabel;
    private javax.swing.JTable masterTable;
    private javax.swing.JScrollPane masterscrollpane;
    private javax.swing.JTextField mot1;
    private javax.swing.JTextField mot2;
    private javax.swing.JTextField mot3;
    private javax.swing.JTextField origOuCopieF;
    private javax.persistence.Query query;
    private javax.swing.JPanel recherches;
    private javax.swing.JTextArea resumeArea;
    private javax.swing.JLabel resumeLabel;
    private javax.swing.JLabel sourceLabel;
    private javax.swing.JButton suivant;
    private javax.swing.JPanel tablePanel;
    private javax.swing.JLabel titreLabel;
    private javax.swing.JTextField typdocF;
    private javax.swing.JLabel typedocumentLabel1;
    private javax.swing.JLabel vignette;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
